package com.etc.controller;

import com.etc.entity.UserRecordFinall;
import com.etc.service.AdminRecordService;
import com.etc.util.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdminRecordController {

    @Autowired
    private AdminRecordService adminRecordService;

    @GetMapping("listRecord")
    public PageData<UserRecordFinall> getPage(@RequestParam(value = "page") Integer page, @RequestParam(value = "limit") Integer limit, @RequestParam(value = "username", required = false) String username) {

        if (username == null) {
            username = "";
        }
        System.out.println("page" + page + "limit" + limit + "username" + username);
        PageData<UserRecordFinall> pageData = adminRecordService.FindRecordForAdmin(page, limit, username);
        pageData.setCode(0);
        return pageData;
    }

}
